{% extends 'ApplicationBootstrapBundle::layout.html.twig' %}

{% block title %}Sticky Footer and Fixed Top Navbar Example for Bootstrap{% endblock %}

{% block layoutstyle %}
    <link href="{{ asset('bundles/applicationbootstrap/css/examples/navbar_fixed_sticky_footer.css') }}" rel="stylesheet" type="text/css" media="all" />
{% endblock %}

{% block stylesheets %}
{% endblock %}

{% block javascripts %}
    <script src="{{ asset('bundles/applicationbootstrap/js/charts/knob/jquery.knob.min.js') }}" type="text/javascript"></script>
    
        <script type="text/javascript">
            $(function($) {

                $(".knob").knob({
                    change : function (value) {
                        //console.log("change : " + value);
                    },
                    release : function (value) {
                        //console.log(this.$.attr('value'));
                        console.log("release : " + value);
                    },
                    cancel : function () {
                        console.log("cancel : ", this);
                    },
                    /*format : function (value) {
                        return value + '%';
                    },*/
                    draw : function () {

                        // "tron" case
                        if(this.$.data('skin') == 'tron') {

                            this.cursorExt = 0.3;

                            var a = this.arc(this.cv)  // Arc
                                , pa                   // Previous arc
                                , r = 1;

                            this.g.lineWidth = this.lineWidth;

                            if (this.o.displayPrevious) {
                                pa = this.arc(this.v);
                                this.g.beginPath();
                                this.g.strokeStyle = this.pColor;
                                this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, pa.s, pa.e, pa.d);
                                this.g.stroke();
                            }

                            this.g.beginPath();
                            this.g.strokeStyle = r ? this.o.fgColor : this.fgColor ;
                            this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, a.s, a.e, a.d);
                            this.g.stroke();

                            this.g.lineWidth = 2;
                            this.g.beginPath();
                            this.g.strokeStyle = this.o.fgColor;
                            this.g.arc( this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
                            this.g.stroke();

                            return false;
                        }
                    }
                });

                // Example of infinite knob, iPod click wheel
                var v, up=0,down=0,i=0
                    ,$idir = $("div.idir")
                    ,$ival = $("div.ival")
                    ,incr = function() { i++; $idir.show().html("+").fadeOut(); $ival.html(i); }
                    ,decr = function() { i--; $idir.show().html("-").fadeOut(); $ival.html(i); };
                $("input.infinite").knob(
                                    {
                                    min : 0
                                    , max : 20
                                    , stopper : false
                                    , change : function () {
                                                    if(v > this.cv){
                                                        if(up){
                                                            decr();
                                                            up=0;
                                                        }else{up=1;down=0;}
                                                    } else {
                                                        if(v < this.cv){
                                                            if(down){
                                                                incr();
                                                                down=0;
                                                            }else{down=1;up=0;}
                                                        }
                                                    }
                                                    v = this.cv;
                                                }
                                    });
            });
        </script>
    
{% endblock %}

{% block navigation %}
    <!-- Fixed navbar -->
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container">
        
            {% include 'ApplicationBootstrapBundle::_navbar.html.twig' %}
        
        </div>
    </nav>
{% endblock %}

{% block body %}
    <div class="container">
        
        <div class="row">
            <div class="col-lg-12">
                <h2 class="page-header">jQuery Knob examples</h2>
            </div>
        </div>
        <!-- /.row -->
        
        <div class="row">
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-displayInput=false value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-displayInput=false
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-displayInput=true value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-displayInput=true
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-cursor=true data-fgColor="#222222" data-thickness=.1 value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
					data-cursor=true<br/>
					data-thickness=.1<br/>
					data-fgColor="#222222"
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-angleOffset="180" data-displayInput=true value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-displayInput=true
                    data-angleOffset="180"
                </code></p>
            </div>
        </div>
        <!-- /.row -->
        
        <div class="row">
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-displayInput=false data-displayPrevious=true data-fgColor="#66EE66" data-skin="tron" data-thickness=".2" value="75">
                <hr/>
                <p><code>
                    data-width="50%"
                    data-fgColor="#66EE66"
                    data-skin="tron"
                    data-thickness=".2"
                    data-displayInput=false
                    data-displayPrevious=true
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-displayPrevious=true data-fgColor="#66EE66" data-skin="tron" data-thickness=".2" value="75">
                <hr/>
                <p><code>
                    data-width="50%"
                    data-fgColor="#66EE66"
                    data-skin="tron"
                    data-thickness=".2"
                    data-displayPrevious=true
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-displayPrevious=true data-fgColor="#66EE66" data-skin="tron" data-cursor=true value="75" data-thickness=".2">
                <hr/>
                <p><code>
                    data-width="50%"
                    data-cursor=true
                    data-fgColor="#66EE66"
                    data-skin="tron"
                    data-thickness=".2"
                    data-displayPrevious=true
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-angleOffset="180" data-fgColor="#66EE66" data-skin="tron" data-thickness=".2" value="75">
                <hr/>
                <p><code>
                    data-width="50%"
                    data-fgColor="#66EE66"
                    data-skin="tron"
                    data-thickness=".1"
                    data-angleOffset="180"
                </code></p>
            </div>
        </div>
        <!-- /.row -->
        
        <div class="row">
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-displayInput=true readonly="readonly" value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-displayInput=true
                    readonly="readonly"
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-angleOffset=-125 data-angleArc=250 data-fgColor="#66EE66" data-rotation="anticlockwise" value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-fgColor="#66CC66"
                    data-angleOffset=-125
                    data-angleArc=250
                    data-rotation=anticlockwise
                </code></p>
            </div>
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-angleOffset=90 data-linecap=round value="35">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-angleOffset=90
                    data-linecap=round
                </code></p>
            </div>
            
            <div class="col-lg-3">
                <input class="knob" data-width="50%" data-min="-100" data-displayPrevious=true value="44">
                <hr/>
                <p><code>
                    data-width="50%"<br/>
                    data-displayPrevious=true
                    data-min="-100"
                </code></p>
            </div>
        </div>
        <!-- /.row -->
        
        <div class="row">
            <div class="col-lg-12">
                <h2 class="page-header">Superpose (clock)</h2>
                
		        <script type="text/javascript">
			        function clock() {
			            var $s = $(".second"),
			                $m = $(".minute"),
			                $h = $(".hour");
			                d = new Date(),
			                s = d.getSeconds(),
			                m = d.getMinutes(),
			                h = d.getHours();
			            $s.val(s).trigger("change");
			            $m.val(m).trigger("change");
			            $h.val(h).trigger("change");
			            setTimeout("clock()", 1000);
			        }
			        clock();
		        </script>
            
	            <div style="position:relative;width:325px;height:325px;margin:auto;">
	                <div style="position:absolute;left:10px;top:10px">
	                    <input class="knob hour" readonly="readonly" data-min="0" data-max="24" data-bgColor="#F1F1F1" data-fgColor="#ffec03" data-displayInput=false data-width="300" data-height="300" data-thickness=".3">
	                </div>
	                <div style="position:absolute;left:60px;top:60px">
	                    <input class="knob minute" readonly="readonly" data-min="0" data-max="60" data-bgColor="#F1F1F1" data-displayInput=false data-width="200" data-height="200" data-thickness=".45">
	                </div>
	                <div style="position:absolute;left:110px;top:110px">
	                    <input class="knob second" readonly="readonly" data-min="0" data-max="60" data-bgColor="#F1F1F1" data-fgColor="rgb(127, 255, 0)" data-displayInput=false data-width="100" data-height="100" data-thickness=".3">
	                </div>
	            </div>
            </div>
        </div>
        <!-- /.row -->
    </div> <!-- /container -->
{% endblock %}